<?php
class Tourism_headline_model extends  BZ_Model 
{
    protected $table   = 'tourism_headline';
    protected $table_2 = 'tourism_headline_topic';
    
    public function pagelist($page_num,$num,$param = array()){
        $this->db->select('a.*,b.name');
        $this->db->from($this->table.' as a');
        $this->db->join($this->table_2.' as b','a.topic_id = b.id');
        if (!empty($param['title'])) {
            $this->db->where('title',$param['title']);
        }
        $this->db->where('provider_id',$param['provider_id']);
        $this->db->limit($page_num,$num);
        $this->db->order_by('sort');
        return $this->db->get();
    }
    
    public function delete($id){
        $this->db->where('id',$id);
        return $this->db->delete($this->table);
    }
}